<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-if指令</title>
</head>
<body>
<div id="app">
    <input type="button" value="切换显示" @click="toggleIsShow">
    <p v-if="isShow">hi vue</p>
    <p v-show="isShow">hi vue - v-show修饰</p>
    <h2 v-if="temperature>=35">热死了</h2>
</div>

<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    var vue = new Vue({
        el: "#app",
        data: {
            isShow: false,
            temperature: 20
        },
        methods: {
            toggleIsShow() {
                this.isShow = !this.isShow;
            }
        }
    })
</script>
</body>
</html>
